package generator.workflow;

import generator.datastructure.MethodDeclaration;
import generator.datastructure.WritebleClass;
import generator.util.input_interpreter.ParallelizerInterpreter;
import generator.util.input_interpreter.PolicyInterpreter;

import java.util.List;

public abstract class PolicyManager {

	protected PolicyInterpreter policyInterpreter;
	
	protected ParallelizerInterpreter parallelizerInterpreter;	
	
	public ParallelizerInterpreter getParallelizerInterpreter() {
		return parallelizerInterpreter;
	}

	public void setParallelizerInterpreter(
			ParallelizerInterpreter parallelizerInterpreter) {
		this.parallelizerInterpreter = parallelizerInterpreter;
	}
	
	public PolicyInterpreter getPoliticInterpreter() {
		return policyInterpreter;
	}

	public void setPolicyInterpreter(PolicyInterpreter policyInterpreter) {
		this.policyInterpreter = policyInterpreter;
	}
	
	public void addPolicyMechanism(WritebleClass peerClass) {
			
		
		
		List<MethodDeclaration> msd = parallelizerInterpreter.getMethodsToParallelize();
		
		for (MethodDeclaration md : msd) {
			this.addApplicationPolicies(md, peerClass);
			this.addMiddlewarePolicies(md, peerClass);
		}
		
				
	}			
		
	protected abstract void addApplicationPolicies(MethodDeclaration md, WritebleClass peerClass);

	protected abstract void addMiddlewarePolicies(MethodDeclaration md, WritebleClass peerClass);
	
	protected abstract WritebleClass getPeerWithPolicies();	

}
